/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DownLoadFile;

import ListeningThread.ListeningThread;
import ReadTorrent.ReadTorrent;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.logging.Level;
import java.util.logging.Logger;
import requestDataPacket.requestData;

/**
 *
 * @author THANG
 */
public class DownLoadFile extends Thread{
    private boolean listen = true;
    @Override
    public void run()
    {
        while(listen)
        {
             byte[] buff = new byte[1024];
            DatagramPacket p = new DatagramPacket(buff, buff.length);
            try {
                DatagramSocket socket = new DatagramSocket(9809);
                socket.receive(p);
                FileOutputStream fo = new FileOutputStream("d7cb17011113b99ef12513615917e17cc6a710216a119163a4126");
                fo.write(p.getData());
                System.out.print("aaaaaaa");
            } catch (IOException ex) {
                
            }
        }
    }
}
